﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="WorkList.aspx.cs" Inherits="Admin_NewsStat" MasterPageFile="~/Admin/Admin.master" %>

<asp:Content ID="Content1" runat="Server" ContentPlaceHolderID="MainPlace">
<h1>All Works</h1>
<asp:HyperLink runat="server" ID="hlAddNewWork" NavigateUrl="~/Admin/AddWork.aspx" Text="Add Work" ></asp:HyperLink>
<asp:DropDownList runat="server" ID="ddTags" DataValueField="ID" AutoPostBack="true" 
        DataTextField="TagName" onselectedindexchanged="ddTags_SelectedIndexChanged">
            </asp:DropDownList>
    <asp:GridView ID="gvNews" runat="server" AutoGenerateColumns="false" CssClass="SiteStats"
        AllowPaging="true" AlternatingRowStyle-CssClass="SiteStatsA" RowStyle-CssClass="SiteStats"
        Width="98%" AllowSorting="true" OnSorting="gvNews_Sorting" OnRowDataBound="gvNews_RowBound"
         PagerSettings-Visible="true"  PageSize="60" 
        OnPageIndexChanging="gvNews_PageindexChanging" >
        <Columns>
            <asp:BoundField DataField="PublishDate" SortExpression="Date" HeaderText="Дата" HeaderStyle-CssClass="StatsHeader"/>
            <asp:BoundField DataField="Title" HeaderText="Work" SortExpression="Title" HeaderStyle-CssClass="StatsHeader"/>
            <asp:TemplateField HeaderText="Показывать на сайте" HeaderStyle-CssClass="StatsHeader" >
                <ItemTemplate>
                <asp:CheckBox runat="server" ID="chkVisible" CommandArgument='<%# Eval("ID") %>' AutoPostBack="true" OnCheckedChanged="chkVisible_Changed" Checked='<%# Eval("Isvisible") %>' />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Действие" HeaderStyle-CssClass="StatsHeader">
            <ItemTemplate>
               <asp:Button OnCommand="btnDeleteNews_Click" CausesValidation="false" UseSubmitBehavior="false" CommandArgument='<%# Eval("ID") %>'
                    Text='удалить' ID="btnDeleteNews" CssClass="but" runat="server"  />
              <asp:Button OnCommand="btnEditNews_Click" UseSubmitBehavior="false" CommandArgument='<%# Eval("ID") %>'
                    Text="редактировать" runat="server" ID="btnEditNews" CssClass="but" />
            </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
</asp:Content>